#include <iostream>

#include <google/protobuf/json/json.h>
#include <google/protobuf/message.h>
#include <google/protobuf/util/json_util.h>

#include <protobuf_test/point.pb.h>

int
main ()
{
  protobuf_test::Point point;

  point.set_x (10);
  point.set_y (20);

  std::string json;
  auto status = google::protobuf::json::MessageToJsonString (point, &json);
  if (!status.ok ())
    {
      std::cerr << "failed to convert message to string: " << status.message ()
                << std::endl;
      return 1;
    }

  std::cout << json << std::endl;
  return 0;
}
